<template>
  <div class="analysis-page" style="font-size: initial">
    <div class="title">技术分析 > {{titleTxt}}</div>
    <section class="container">
      <div class="main">
        <!-- 检索 -->
        <Search 
        :ctNavID="ctNavID" 
        :routerName="routerName"
        :apiName="apiName"
        ></Search>
        <br />
        <!-- 列表 -->
        <!-- <TablePatent v-if="isShowTablePatent" :listData='listData'/> -->
        <!-- <TablePaper v-else :listData='listData'/> -->
        <JSC v-if="this.techAnTy == 'jscsd'" :chartsData="chartsData"></JSC>
        <JSQ v-if="this.techAnTy == 'jsqsd'" :chartsData="chartsData"></JSQ>
        <QYJ v-if="this.techAnTy == 'qyly'" :chartsData="chartsData"></QYJ>
        <SMZ v-if="this.techAnTy == 'smzq'" :chartsData="chartsData"></SMZ>
      </div>
    </section>
  </div>
</template>

<script>
import Search from "./Search.vue";
import TablePatent from "./tablePatent.vue";
import TablePaper from "./tablePaper.vue";

import JSC from "./charts/jsc.vue";
import JSQ from "./charts/jsq.vue";
import QYJ from "./charts/qyj.vue";
import SMZ from "./charts/smz.vue";
export default {
  components: {
    Search,
    TablePatent,
    TablePaper,
    JSC,
    JSQ,
    QYJ,
    SMZ,
  },
  data() {
    return {
      ctNavID:'',
      routeName: "",
      searchTxt: "",
      tempList: [],
      all_total: 0,
      listData:{},
      isShowTablePatent:true,
      isShowTablePaper:false,

      titleTxt:'',
      routerName:'',
      apiName:'',

      techAnTy:'',
      isshowSearch:false,
      chartsData:[],
      
    };
  },
  watch: {
    $route() {
      this.ctNavID = String(this.$route.query.type)
      this.isShowTablePatent = this.ctNavID == 'patent' ? true : false;
      this.techAnTy = String(this.$route.query.techAnTy) 
      this.handleTitleTxt(this.techAnTy)
    },
  },
  created() {  },
  mounted() {
    this.ctNavID = String(this.$route.query.type) ;
    this.techAnTy = String(this.$route.query.techAnTy) ;
    this.handleTitleTxt(this.techAnTy) ;

    this.$Bus.$on('techAnalysisData', data => {
      //绘图数据
      this.chartsData = data
    })
  },
  methods: {
    handleTitleTxt(techAnTy){
      switch(techAnTy){
        case 'smzq' :
          this.titleTxt = '技术生命周期';
          this.apiName = this.$Url.analysis.analysis_ana_life_patent;
          break;
        case 'jsqsd' :
          this.titleTxt = '技术趋势路线图';
          this.apiName = this.$Url.analysis.analysis_ana_trend;
          break;
        case 'qyly' :
          this.titleTxt = '技术前沿领域分析';
          this.apiName = this.$Url.analysis.analysis_heatMap;
          break;
        case 'jscsd' :
          this.titleTxt = '技术成熟度';
          this.apiName = '技术成熟度接口名';
          break;
        default:
      }
    }
  },
  beforeDestroy() {
    this.$Bus.$off("dcData");
  },
};
</script>

<style lang="scss" scoped>
.title{
  background: #f2f9ff;
  color: #4f63c8;
  font-size: 0.14rem;
}
::v-deep {
  .el-button--primary {
    border-color: $color141 !important;
    background-color: $color141 !important;
  }
  .el-checkbox__label {
    font-size: 12px !important;
    color: $color32;
  }
  .el-checkbox__input.is-checked + .el-checkbox__label {
    color: #000 !important;
  }
  .el-dropdown-menu__item {
    font-size: 12px !important;
  }
  .el-select-dropdown__item.selected {
    color: $color141 !important;
  }
  .el-pager li.active {
    color: $color141 !important;
  }
  // 选择数据源
  .el-dialog__header {
    background-color: $color4;
  }
  .el-dialog__body {
    // padding: 0 20px !important;
  }
  .group-title-cnt .el-checkbox__label {
    font-size: 14px;
    font-weight: 700;
    color: #000 !important;
  }
  .group-world {
    .el-checkbox__input {
      line-height: normal;
    }
    .el-checkbox__label {
      font-size: 12px;
      color: #000 !important;
    }
  }
  // 筛选项
  .tree-items {
    .el-checkbox__label {
      padding-left: 5px;
      font-size: 12px !important;
    }
  }
  .mode-select,
  .sort-select {
    .el-input__inner {
      height: 34px;
      line-height: 34px;
      border: none;
      color: $color30;
    }
  }
  // 分页
  .pagination .page-size .el-input__inner {
    height: 28px;
    line-height: 28px;
  }
  .el-select-dropdown__item {
    text-indent: 10px;
  }

  // 参数配置
  .search-time {
    // .el-date-editor.el-input {
    //   width: 142px;
    //   .el-input__inner {
    //     border: 0;
    //     background-color: $color2;
    //   }
    // }
  }
  // 分析页面
  .m-slot {
    &.no-margin {
      margin-bottom: 0 !important;
    }
    .btn-group {
      .icon {
        font-size: 18px !important;
      }
    }
    h4 {
      line-height: 40px;
      font-size: 13px;
      font-weight: normal;
      color: $color130;
    }
    .date-box {
      position: relative;
      display: inline-block;
      margin-right: 20px;
      font-size: 13px;
      .tit {
        display: inline-block;
        padding-right: 14px;
        font-size: 12px;
        color: $color6;
      }
      .search-time {
        display: inline-flex;
        align-items: center;
        .split {
          position: relative;
          display: inline-block;
          width: 10px;
          margin: 0 10px;
          &:before {
            position: absolute;
            top: 50%;
            left: 0;
            width: 100%;
            height: 1px;
            background-color: $color31;
            content: "";
          }
        }
      }
    }
    .select-box {
      position: relative;
      display: inline-block;
      margin-right: 20px;
      font-size: 13px;
      .tit {
        display: inline-block;
        padding-right: 14px;
        font-size: 12px;
        color: $color6;
      }
      .select {
        width: 142px;
        .el-input__inner {
          padding-left: 15px;
          border: 0;
          font-size: 12px;
          background-color: $color4;
        }
        // .el-input__inner {
        //   border: 0;
        //   background-color: $color2;
        // }
      }
    }
    .right-tools {
      position: absolute;
      top: 0;
      right: 0;
      // width: 176px;
      padding-right: 10px;
      text-align: right;
      > span {
        display: inline-block;
        width: 78px;
        line-height: 26px;
        border: 1px solid $mainColor;
        border-radius: 30px;
        margin-left: 10px;
        text-align: center;
        font-size: 12px;
        color: $color2;
        background-color: $mainColor !important;
        cursor: pointer;
        &:nth-of-type(1) {
          margin-left: 0;
        }
      }
    }
  }

  // 分析-图表
  .chart-box {
    position: relative;
    width: 100%;
    .chart {
      width: 100%;
      height: calc(100vh - 0.7rem - 40px - 40px - 70px - 41px - 70px);
    }
    .chart-loading-box {
      position: absolute;
      top: 50%;
      left: 0;
      width: 100%;
      margin-top: -5em;
      max-height: 100%;
    }
  }
  .picker-box {
    position: relative;
    display: inline-block;
    .el-date-picker {
      position: relative;
      width: 142px !important;
      height: 30px;
      .el-input__inner {
        padding-left: 15px;
        border: 0;
        font-size: 12px;
        background-color: $color4;
      }
    }
    .icon-riqi {
      position: absolute;
      top: 0;
      right: 10px;
      line-height: 32px;
      font-size: 21px;
      color: $mainColor;
    }
  }

  // 分析页面的表格
  .chart-tab {
    width: 100%;
    overflow-x: auto;
    .chart-tab-ul {
      position: relative;
      min-width: max-content;
      li {
        position: relative;
        display: flex;
        width: 100%;
        padding: 8px 0;
        border-bottom: 1px solid $color162;
        font-size: 12px;
        color: $color143;
        &.tit {
          background-color: $color154;
          p {
            font-size: 12px;
            font-weight: bold;
            color: $color10;
          }
        }
        &.content {
          &:nth-of-type(2n-1) {
            background-color: $color161;
          }
          &:nth-of-type(2n) {
            background-color: #fff;
          }
          &:hover {
            &:before {
              position: absolute;
              top: 0;
              left: 0;
              width: 3px;
              height: 100%;
              background-color: $color164;
              content: "";
            }
            background-color: $color163 !important;
          }
          p {
            &:first-of-type {
              color: $color6;
            }
          }
        }
        p {
          flex: 1;
          display: inline-flex;
          align-items: center;
          justify-content: center;
          min-width: 75px;
          line-height: 23px;
          padding: 0 10px;
          text-align: center;
        }
      }
    }
  }
}
.analysis-page {
  position: relative;
  width: 100%;
  min-height: calc(100vh - 1rem);
  background-color: $color152;
}
.container {
  display: flex;
  flex-wrap: wrap;
  min-width: 1240px;
  .main {
    flex: 1;
    width: 100%;
    min-width: 0; // 重点
    padding: 10px 50px 0;

    > .tools {
      position: relative;
      display: inline-flex;
      align-items: center;
      justify-content: flex-end;
      width: 100%;
      margin-top: 10px;
      margin-bottom: 10px;
      button {
        width: 100px;
        height: 30px;
        border-color: $mainColor;
        border-radius: 15px;
        font-size: 12px;
        color: $color51;
        background-color: $mainColor;
        cursor: pointer;
        i {
          margin-right: 2px;
        }
      }
      .download-center-btn {
        font-size: 14px;
        margin-left: 10px;
        text-decoration: underline;
        color: #242424;
        cursor: pointer;
        &:hover {
          color: $mainColor;
        }
      }
    }
  }
}
// animate
.slide-fade-enter-active {
  transition: all 0.2s ease;
}
.slide-fade-enter {
  margin-right: -256px;
  opacity: 0;
}
</style>